<div id="main-content">
  <div class="container-fluid">
    <div class="row-fluid">
			<div class="span12">
				<div class="nonboxy-widget">
					<div class="widget-head">
						<h5><i class="black-icons blocks_images"></i>Add Kunjungan Supervisi</h5>
					</div>
					<div class="widget-content">
						<div class="widget-box">
              <?php print $this->form_eksternal->form_open("", 'class=" form-horizontal well" id="formoutlet"', array("id_detail" => $detail[0]->id_kunjungan_supervisi));
              ?>
              <div class="row-fluid">
                    <div class="span12 form-horizontal well tab-pane">
								<fieldset>

									<div class="control-group">
										<label class="control-label">PIC</label>
										<div class="controls">
                      <?php print $this->form_eksternal->form_input("pic", $detail[0]->pic)?>
										</div>
									</div>
									<div class="control-group">
										<label class="control-label">Tanggal</label>
										<div class="controls">
                      <?php print $this->form_eksternal->form_date("tanggal_buat", $detail[0]->tanggal_buat, "tanggal_buat", "", " onSelect : function(dateText){ 
                        var d = new Date(dateText);
                        $('#code_tanggal').text(d.getDate()+''+(d.getMonth()+1)+''+d.getFullYear());
                        $('#tanggal_tiket').val(dateText);
                        },")?>
										</div>
									</div>

                  <div class="control-group">
										<label class="control-label">Due Date</label>
										<div class="controls">
                      <?php print $this->form_eksternal->form_date("due_date", $detail[0]->due_date, "due_date", "")?>
										</div>
									</div>

                  <div class="control-group">
										<label class="control-label">Status</label>
										<div class="controls">
                      <?php print $this->form_eksternal->form_dropdown("status", array(1 => "Progres", 2 => "Dijalankan", 3 => "Diabaikan"),array($detail[0]->status))?>
										</div>
									</div>
									
									<div class="control-group">
										<label class="control-label">Temuan Masalah</label>
										<div class="controls">
                      <?=$this->form_eksternal->form_textarea('problem', $detail[0]->problem)?>
										</div>
									</div>
                  <div class="control-group">
										<label class="control-label">Penyebab Masalah</label>
										<div class="controls">
                      <?=$this->form_eksternal->form_textarea('penyebab_masalah', $detail[0]->penyebab_masalah)?>
										</div>
									</div>
                  <div class="control-group">
										<label class="control-label">Saran. Tindak Lanjut</label>
										<div class="controls">
                      <?=$this->form_eksternal->form_textarea('saran', $detail[0]->saran)?>
										</div>
									</div>
								</fieldset>
              </div>

            </div>
              	<div class="form-actions">
									<button class="btn btn-primary" type="submit">Save changes</button>
									<button class="btn" onclick="history.go(-1);return false;">Cancel</button>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
  </div>
</div>
<script>
  $(function () {
    $("#cekprivilege").click(function(){
      $("#showprivilege").fadeToggle();
    });
    var person = {1:"SDM", 2:"SRV", 3:"ADM", 4:"PRO", 5:"TOL", 6:"IT", 7:"PRT", 9:"LL"};
    $( "#topic" ).change(function(){
      $( "#pic_pica" ).autocomplete('option', 'source', "<?php print site_url("outlet/tambahan/auto-pic-pica")?>/"+$("#topic").val());
      $("#code_topic").text(person[$("#topic").val()]);
      $("#code_tiket").val(person[$("#topic").val()]);
      $.post('<?php print site_url("customer-service/get-dropdown-kategori/")?>/'+$("#topic").val(),{no:3},function(data){
        $("#kategori").html(data);
      });
    });
    
    $( "#outlet" ).autocomplete({
      source: "<?php print site_url("outlet/tambahan/auto-outlet")?>",
      minLength: 1,
      select: function( event, ui ) {
        console.log(ui);
        $("#id_outlet").val(ui.item.id);
        $("#laporan").show();
        $( "#actifity_report" ).autocomplete('option', 'source', "<?php print site_url("outlet/tambahan/auto-activity/")?>/"+$("#id_outlet").val()+"/");
      }
    });
    $( "#actifity_report" ).autocomplete({
      source: "<?php print site_url("outlet/tambahan/auto-activity")?>",
      minLength: 1,
      select: function( event, ui ) {
        $("#id_actifity_report").val(ui.item.id);
      }
    });
    $( "#pic_pica" ).autocomplete({
      source: "<?php print site_url("outlet/tambahan/auto-pic-pica/".$detail[0]->kategori)?>",
      minLength: 1,
      select: function( event, ui ) {
        $("#id_pic_pica").val(ui.item.id);
      }
    });
    
  });
  
  function del_row_lokal(tr){
    $("#"+tr).remove();
  }
//  $( "p" ).replaceWith( "<b>Paragraph. </b>" );
</script>